import time
import tkinter
import threading

root = tkinter.Tk()
root.title('倒计时自动关闭的窗口')
root['width'] = 400
root['height'] = 300
root.resizable(False, False)

richText = tkinter.Text(root,  width=380)
richText.place(x=10, y=10, width=380, height=230)
richText.insert('0.0','假设阅读这些文字需要10秒时间')

IbTime = tkinter.Label(root,  fg='red',anchor='w')
IbTime.place(x=10, y=250, width=380)

def autoClose():
    for i in range(10):
        IbTime['text'] = '距离窗口关机还有{}秒'.format(10-i)
        time.sleep(1)
    root.destroy()

t = threading.Thread(target=autoClose)
t.start()

root.mainloop()
 
 